<template>
  <div class="py-2">
    <div class="text-center">玩法</div>
    <div class="d-flex flex-wrap px-2">
      <div class="rule" :class="{on: value.rule == r.rule}" :style="{flexBasis: w}" :key="i" @click="$emit('input', r)" v-for="(r, i) in rules">
        <a>{{r.ruleName}}</a>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  props: ['value', 'rules', 'size'],
  name: 'rules',
  computed: {
    w () { return 100 / this.size + '%' }
  }
}
</script>
